# -*- coding: utf-8 -*-
# @Time : 2021/9/17 21:59
# @Author : 伟哥
# @Email : xw@gmail.com
# @File : set_page.py
# @Project : mryx_test
'''设置页面的定位器及操作'''
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.webdriver.common.mobileby import MobileBy as By
from page.base_page import BasePage
class Set(BasePage):
    '''设置页面'''
    clear_locator = (By.XPATH, '//android.widget.ImageView[@content-desc=\"清除缓存\"]')
    assertion_locator = (By.XPATH,'//*[contains(text(),"清除了")]')

    def clear(self):
        '''点击清除缓存'''
        self.driver.find_element(*self.clear_locator).click()

    def assertion(self):
        '''获取清除语句'''
        wait = WebDriverWait(self.driver, 5, 0.2)
        clear = wait.until(EC.presence_of_element_located(self.assertion_locator))
        return clear.text